package com.lanvideo.entity;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.LocalDateTime;

/**
 * 考试实体类
 */
public class Exam {
    private Integer id;
    private String title;
    private String description;
    private Integer teacherId;
    private Integer totalQuestions; // 题目库中的题目总数
    private Integer examQuestions; // 实际应考的题目数量
    private Integer totalScore;
    private Integer timeLimit; // 考试时间限制（分钟）
    private Integer status; // 0:草稿 1:已发布 2:已结束
    private LocalDateTime createdTime;
    private LocalDateTime updatedTime;
    
    // 关联字段
    private String teacherName;
    private Integer studentCount; // 参与学生数量
    private Integer completedCount; // 已完成学生数量
    @JsonProperty("studentStatus")
    private Integer studentStatus; // 学生在该考试中的状态 (0:未开始 1:进行中 2:已完成)
    @JsonProperty("studentScore")
    private Integer studentScore; // 学生在该考试中的得分

    public Exam() {}

    public Exam(String title, String description, Integer teacherId, Integer timeLimit) {
        this.title = title;
        this.description = description;
        this.teacherId = teacherId;
        this.timeLimit = timeLimit;
        this.status = 0; // 默认草稿状态
        this.totalQuestions = 0;
        this.examQuestions = 0;
        this.totalScore = 0;
    }

    // Getters and Setters
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getTeacherId() {
        return teacherId;
    }

    public void setTeacherId(Integer teacherId) {
        this.teacherId = teacherId;
    }

    public Integer getTotalQuestions() {
        return totalQuestions;
    }

    public void setTotalQuestions(Integer totalQuestions) {
        this.totalQuestions = totalQuestions;
    }

    public Integer getExamQuestions() {
        return examQuestions;
    }

    public void setExamQuestions(Integer examQuestions) {
        this.examQuestions = examQuestions;
    }

    public Integer getTotalScore() {
        return totalScore;
    }

    public void setTotalScore(Integer totalScore) {
        this.totalScore = totalScore;
    }

    public Integer getTimeLimit() {
        return timeLimit;
    }

    public void setTimeLimit(Integer timeLimit) {
        this.timeLimit = timeLimit;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public LocalDateTime getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(LocalDateTime createdTime) {
        this.createdTime = createdTime;
    }

    public LocalDateTime getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(LocalDateTime updatedTime) {
        this.updatedTime = updatedTime;
    }

    public String getTeacherName() {
        return teacherName;
    }

    public void setTeacherName(String teacherName) {
        this.teacherName = teacherName;
    }

    public Integer getStudentCount() {
        return studentCount;
    }

    public void setStudentCount(Integer studentCount) {
        this.studentCount = studentCount;
    }

    public Integer getCompletedCount() {
        return completedCount;
    }

    public void setCompletedCount(Integer completedCount) {
        this.completedCount = completedCount;
    }

    public Integer getStudentStatus() {
        return studentStatus;
    }

    public void setStudentStatus(Integer studentStatus) {
        this.studentStatus = studentStatus;
    }

    public Integer getStudentScore() {
        return studentScore;
    }

    public void setStudentScore(Integer studentScore) {
        this.studentScore = studentScore;
    }

    public String getStatusText() {
        switch (status) {
            case 0: return "草稿";
            case 1: return "已发布";
            case 2: return "已结束";
            default: return "未知";
        }
    }
}
